﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SimpleSalesTrackingAPIWrapper
{
    public class Documents
    {
        // Get list of all Documents belonging to this company
        public static List<SimpleSalesTrackingAPI.Document> GetDocumentsByOwner(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return new List<SimpleSalesTrackingAPI.Document>(api.GetDocumentsByOwner(username, password));
        }

        // Get list of all Documents belonging to the currently authenticated user.
        public static List<SimpleSalesTrackingAPI.Document> GetDocumentsByUser(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return new List<SimpleSalesTrackingAPI.Document>(api.GetDocumentsByUser(username, password));
        }

        // Get a single Document, by documentId
        public static SimpleSalesTrackingAPI.Document GetDocumentById(string username, string password, int documentId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.GetDocumentById(username, password, documentId);
        }

        // Insert a new Document
        public static int InsertDocument(string username, string password, SimpleSalesTrackingAPI.Document document)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.InsertDocument(username, password, document);
        }

        // Insert a new Document
        public static int InsertDocument(string username, string password, int saleId, string name, byte[] data, string contentType)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.InsertDocument2(username, password, saleId, name, data, contentType);
        }

        // Update an existing Document
        public static int UpdateDocument(string username, string password, SimpleSalesTrackingAPI.Document document)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.UpdateDocument(username, password, document);
        }

        // Update an existing Document
        public static int UpdateDocument(string username, string password, int documentId, int saleId, string name, byte[] data, string contentType)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.UpdateDocument2(username, password, documentId, saleId, name, data, contentType);
        }

        // Delete an existing Document
        public static int DeleteDocument(string username, string password, SimpleSalesTrackingAPI.Document document)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.DeleteDocument(username, password, document);
        }

        // Delete an existing Document
        public static int DeleteDocument(string username, string password, int documentId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.DeleteDocument2(username, password, documentId);
        }
    }
}
